package Select_Structure;

import java.util.Scanner;

/**switch的新特性
 * jdk 14支持箭头函数
 *
 */
public class swtich_demo2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入1~7之间的数字：");
        int weekDay = scan.nextInt();
        switch (weekDay){
            case 1 -> System.out.println("星期一");
            /**相当于:
*                 case 1:
*                 System.out.println("星期一");//如果满足case1，如果后面没有break，将继续向下执行而且不再判定case
*                 break;//一旦执行，立马结束swtich
             * */
            case 2 -> System.out.println("星期二");
            case 3 -> System.out.println("星期三");
            case 4 -> System.out.println("星期四");
            case 5 -> System.out.println("星期五");
            case 6 -> System.out.println("星期六");
            case 7 -> System.out.println("星期日");
            default -> System.out.println("请输入1~7的数字");


        }
    }
}
